﻿function openPage(url, title, width, height) {
    var features = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=' + width + ',height=' + height + '';
    window.open(urlRandomParam(url), title, features);
}

function openModalDialog(url, title, width, height) {
//    var feature;
//    if ($.browser.msie) {
//            feature = "dialogWidth:" + width + "px;dialogHeight:" + height + "px;status:no;help:no;location:no";
//            window.showModalDialog(urlRandomParam(url), window, feature);  
//    }
//    else if ($.browser.mozilla) {
//        feature = "width=" + width + ",height=" + height + ",menubar=no,toolbar=no,location=no,scrollbars=no,status=no,modal=yes";
//        window.open(urlRandomParam(url), title, feature);  
//    }
//    else {
        var features = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=' + width + ',height=' + height + '';
        window.open(urlRandomParam(url), title, features);
    //}
}

function urlRandomParam(url) {
    var newUrl = url;

    if (newUrl.indexOf('?') >= 0) {
        newUrl = newUrl + "&Now=" + dateToString(new Date());
    }
    else {
        newUrl = newUrl + "?Now=" + dateToString(new Date());
    }
    return newUrl;
}

function closeSelf() {
    window.opener = null;
    window.open('', '_self'); 
    window.close();
}

function closeParent() {
    window.parent.opener = null;
    window.parent.open('', '_self');
    window.parent.close();
    
}

function dateToString(date) {
    return date.getFullYear().toString() + "-" + date.getMonth().toString() + "-" + date.getDate().toString() + " " + date.getHours().toString() + ":" + date.getMinutes().toString() + ":" + date.getSeconds().toString() + "." + date.getMilliseconds().toString();
}

function getSoftPhonePageObject() {
   
    return window.parent.frameSoftPhone;
}




function clearSearchForm() {
    $('.search .txt').val('');
    $('.search .datetime').val('');
    $('.search .ddl').val('');
    return false;
}

